// 百分比校验
const percentValidator = (_: never, value: any) => value > 100 ? Promise.reject(new Error('比例最大为100%')) : Promise.resolve();

// 首处医生 + 固定金额
const doctorsNumberWithFixed = {
  preContent: {
    label: '首处医生数',
    unit: '人',
    placeholder: '请输入人数',
    hasInfinity: true,
  },
  afterHalfContent: {
    label: '首处奖励金额',
    placeholder: '请输入金额',
    unit: '元/人'
  }
}

// 首处医生 + 分润
const doctorsNumberWithPercent = {
  preContent: {
    label: '首处医生数',
    unit: '人',
    placeholder: '请输入人数',
    hasInfinity: true,
  },
  afterHalfContent: {
    label: '首处分润比例',
    placeholder: '请输入比例',
    unit: '%',
    validator: percentValidator,
  }
}

// 首处客单价 + 固定金额
const customerPriceWithFixed = {
  preContent: {
    label: '首处客单价',
    unit: '元',
    placeholder: '请输入金额',
    hasInfinity: true,
  },
  afterHalfContent: {
    label: '首处奖励金额',
    placeholder: '请输入金额',
    unit: '元/人'
  }
}

// 首处客单价 + 分润
const customerPriceWithPercent = {
  preContent: {
    label: '首处客单价',
    unit: '元',
    placeholder: '请输入金额',
    hasInfinity: true,
  },
  afterHalfContent: {
    label: '首处分润比例',
    placeholder: '请输入比例',
    unit: '%',
    validator: percentValidator,
  }
}

const RULE_TYPE = {
  doctorsNumberWithFixed,
  doctorsNumberWithPercent,
  customerPriceWithFixed,
  customerPriceWithPercent
}
export default RULE_TYPE;